package com.gin.no_gay_alliance.viewmodel;

import java.util.List;

/**
 * 分页数据
 *
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/9/18 16:08
 **/
public class PageData<T> {
    /**
     * 数据
     */
    public List<T> data;
    /**
     * 总条数
     */
    public int totalCount;
    /**
     * 总页数
     */
    public int totalPage;
    /**
     * 每页条数
     */
    public int size;
    /**
     * 当前页
     */
    public int page;

    public PageData(List<T> data, int page, int size, int totalCount) {
        this.data = data;
        this.totalCount = totalCount;
        this.totalPage = totalCount / size + (totalCount % size > 0 ? 1 : 0);
        this.size = size;
        this.page = page;
    }
}
